package com.kws.merchant.controller;


import com.kws.merchant.domain.OperationDevice;
import com.kws.merchant.domain.po.OperationDevicePo;
import com.kws.merchant.domain.vo.OperationDeviceVo;
import com.kws.merchant.service.OperationDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import com.kws.common.core.domain.R;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.multipart.MultipartFile;

/**
 * 运维-设备台账(OperationDevice)表控制层
 *
 * @author yxy
 * @since 2024-10-25 09:17:53
 */
@RestController
@Api(tags = "运维-设备台账(OperationDevice)")
@RequestMapping("operationDevice")
public class OperationDeviceController {
    /**
     * 服务对象
     */
    @Resource
    private OperationDeviceService operationDeviceService;

    @PostMapping("/page")
    @ApiOperation(value = "分页查询列表")
    public R<Page<OperationDeviceVo>> pageList(@RequestBody OperationDevicePo operationDevicePo) {
        return R.ok(operationDeviceService.pageList(operationDevicePo));
    }

 /*   @GetMapping("/detailById/{id}")
    @ApiOperation(value = "通过主键查询单条数据")
    public R detailById(@PathVariable Integer id) {
        return R.ok(operationDeviceService.getById(id));
    }*/
    /*@PostMapping("/add")
    @ApiOperation(value = "新增数据")
    public R add(@RequestBody OperationDevice operationDevice) {
        return R.ok(operationDeviceService.save(operationDevice));
    }

    @PostMapping("/update")
    @ApiOperation(value = "修改数据")
    public R update(@RequestBody OperationDevice operationDevice) {
        return R.ok(operationDeviceService.updateById(operationDevice));
    }


    @PostMapping("/delete")
    @ApiOperation(value = "删除数据")
    public R delete(@RequestBody List<Integer> idList) {
        return R.ok(operationDeviceService.removeByIds(idList));
    }
*/
    @PostMapping("uploadExcel")
    @ApiOperation("运维-设备台账导入")
    public R uploadExcel(MultipartFile file){
        return R.ok(operationDeviceService.uploadExcel(file));
    }

    @PostMapping("exportExcel")
    @ApiOperation("运维-设备台账导出")
    public R exportExcel(HttpServletResponse response,@RequestBody OperationDevicePo operationDevicePo){
        return R.ok(operationDeviceService.exportExcel(response,operationDevicePo));
    }

    @PostMapping("exportTemplate")
    @ApiOperation("运维-设备台账模板导出")
    public R exportTemplate(HttpServletResponse response){
        return R.ok(operationDeviceService.exportTemplate(response));
    }

}
